<template>
  <view>
    <view>
    	<uni-nav-bar shadow left-icon="left" dark title="供应商审详细" @clickLeft="back" />
    </view>
  <view>
  	<uni-segmented-control :current="current" :values="items" styleType="button" activeColor="#ffaa00" @clickItem="onClickItem" style="background-color: #fff"  />
  </view>
  
  <view>
  	<view v-if="current === 0">
			<view>
				<uni-card>
		<uni-row >
						<uni-col :span="7">
								<view style="line-height:70rpx;font-size:30rpx;">供应商编码:</view>
						</uni-col>
						<uni-col :span="16">
								<uni-easyinput type="text" v-model="tableSupplier.supplierCode" clearSize="0"></uni-easyinput>
						</uni-col>
					</uni-row>
		<uni-row >
			<uni-col :span="7">
					<view style="line-height:70rpx;font-size:30rpx;">供应商名称:</view>
			</uni-col>
			<uni-col :span="16">
					<uni-easyinput type="text" v-model="tableSupplier.supplierName" clearSize="0"></uni-easyinput>
			</uni-col>
		</uni-row>
			<uni-row style="margin-top: 10rpx;">
				<uni-col :span="7">
						<view style="line-height:70rpx;font-size:30rpx;">简称:</view>
				</uni-col>
				<uni-col :span="16">
						<uni-easyinput type="text" v-model="tableSupplier.shortForm" clearSize="0"></uni-easyinput>
				</uni-col>
			</uni-row>
			
			<uni-row style="margin-top: 10rpx;">
				<uni-col :span="7">
						<view style="line-height:70rpx;font-size:30rpx;">英文名称:</view>
				</uni-col>
				<uni-col :span="16">
						<uni-easyinput type="text" v-model="tableSupplier.engName" clearSize="0"></uni-easyinput>
				</uni-col>
			</uni-row>
			
			<uni-row style="margin-top: 10rpx;">
				<uni-col :span="7">
						<view style="line-height:70rpx;font-size:30rpx;">地址:</view>
				</uni-col>
				<uni-col :span="16">
						<uni-easyinput type="text" v-model="tableSupplier.address" clearSize="0"></uni-easyinput>
				</uni-col>
			</uni-row>
							
			<uni-row style="margin-top: 10rpx;">
				<uni-col :span="7">
						<view style="line-height:70rpx;font-size:30rpx;">分组:</view>
				</uni-col>
				<uni-col :span="16">
					<uni-easyinput type="text" v-model="tableSupplier.groupName" clearSize="0"></uni-easyinput>	
				</uni-col>
			</uni-row>
			
			<uni-row style="margin-top: 10rpx;">
				<uni-col :span="7">
						<view style="line-height:70rpx;font-size:30rpx;">采购员:</view>
				</uni-col>
				<uni-col :span="16">
						<uni-easyinput type="text" v-model="tableSupplier.slpName" clearSize="0"></uni-easyinput>
				</uni-col>
			</uni-row>
			
			<uni-row style="margin-top: 10rpx;">
				<uni-col :span="7">
						<view style="line-height:70rpx;font-size:30rpx;">公司简介:</view>
				</uni-col>
				<uni-col :span="16">
						<uni-easyinput type="textarea" v-model="tableSupplier.companyProfile" clearSize="0"></uni-easyinput>
				</uni-col>
			</uni-row>
				<uni-row style="margin-top: 10rpx;">
					<uni-col :span="7">
							<view style="line-height:70rpx;font-size:30rpx;">供应商等级:</view>
					</uni-col>
					<uni-col :span="16">
							<uni-easyinput type="text" v-model="SupplierForm.grade"  placeholder="请输入供应商等级"></uni-easyinput>
					</uni-col>
				</uni-row>
				<uni-row style="margin-top: 10rpx;">
					<uni-col :span="7">
							<view style="line-height:70rpx;font-size:30rpx;">供应商评分:</view>
					</uni-col>
					<uni-col :span="16">
							<uni-easyinput type="text" v-model="SupplierForm.score"  placeholder="请输入供应商评分"></uni-easyinput>
					</uni-col>
				</uni-row>
			</uni-card>
			</view>
	</view>
  </view>
  
  	<view v-if="current === 1">
		<view>
			<uni-card>
		<uni-row style="margin-top: 10rpx;">
			<uni-col :span="7">
					<view style="line-height:70rpx;font-size:30rpx;">统一码:</view>
			</uni-col>
			<uni-col :span="16">
					<uni-easyinput type="text" v-model="tableSupplier.unifiedSocialCreditCode" clearSize="0"></uni-easyinput>
			</uni-col>
		</uni-row>
			<uni-row style="margin-top: 10rpx;">
				<uni-col :span="7">
						<view style="line-height:70rpx;font-size:30rpx;">组织代码:</view>
				</uni-col>
				<uni-col :span="16">
						<uni-easyinput type="text" v-model="tableSupplier.organizeCode" clearSize="0"></uni-easyinput>
				</uni-col>
			</uni-row>
			
			<uni-row style="margin-top: 10rpx;">
				<uni-col :span="7">
						<view style="line-height:70rpx;font-size:30rpx;">企业类型:</view>
				</uni-col>
				<uni-col :span="16">
						<uni-easyinput type="text" v-model="tableSupplier.enterpType" clearSize="0"></uni-easyinput>
				</uni-col>
			</uni-row>
			
			<uni-row style="margin-top: 10rpx;">
				<uni-col :span="7">
						<view style="line-height:70rpx;font-size:30rpx;">注册地:</view>
				</uni-col>
				<uni-col :span="16">
						<uni-easyinput type="text" v-model="tableSupplier.regCountryRegion" clearSize="0"></uni-easyinput>
				</uni-col>
			</uni-row>
			
			<uni-row style="margin-top: 10rpx;">
				<uni-col :span="7">
						<view style="line-height:70rpx;font-size:30rpx;">注册资本:</view>
				</uni-col>
				<uni-col :span="16">
						<uni-easyinput type="text"v-model="tableSupplier.registerCapital" clearSize="0"></uni-easyinput>
				</uni-col>
			</uni-row>
			
			<uni-row style="margin-top: 10rpx;">
				<uni-col :span="7">
						<view style="line-height:70rpx;font-size:30rpx;">建立日期:</view>
				</uni-col>
				<uni-col :span="16">
	
						<uni-easyinput type="text" v-model="tableSupplier.creationDate" clearSize="0"></uni-easyinput>
				</uni-col>
			</uni-row>
			
	
			<uni-row style="margin-top: 10rpx;">
				<uni-col :span="7">
						<view style="line-height:70rpx;font-size:30rpx;">主营品类:</view>
				</uni-col>
				<uni-col :span="16">
						<uni-easyinput type="text" v-model="tableSupplier.mainCategories" clearSize="0"></uni-easyinput>
				</uni-col>
			</uni-row>
			
			
			
			<!-- <uni-collapse>
				<uni-collapse-item title="显示更多内容" title-border="none" :border="false"> -->
			<uni-row style="margin-top: 10rpx;">
				<uni-col :span="7">
						<view style="line-height:70rpx;font-size:30rpx;">认证地区:</view>
				</uni-col>
				<uni-col :span="16">
						<uni-easyinput type="text"v-model="tableSupplier.certificateRegion" clearSize="0"></uni-easyinput>
				</uni-col>
			</uni-row>
			
			
			<uni-row style="margin-top: 10rpx;">
				<uni-col :span="7">
						<view style="line-height:70rpx;font-size:30rpx;">纳税人标识:</view>
				</uni-col>
				<uni-col :span="16">
						<uni-easyinput type="text"v-model="tableSupplier.taxpayerIdentify" clearSize="0"></uni-easyinput>
				</uni-col>
			</uni-row>
			
			
			<uni-row style="margin-top: 10rpx;">
				<uni-col :span="7">
						<view style="line-height:70rpx;font-size:30rpx;">法定代表人:</view>
				</uni-col>
				<uni-col :span="16">
						<uni-easyinput type="text" v-model="tableSupplier.legalRepresent" clearSize="0"></uni-easyinput>
				</uni-col>
			</uni-row>
			
			<uni-row style="margin-top: 10rpx;">
				<uni-col :span="7">
						<view style="line-height:70rpx;font-size:30rpx;">注册币种:</view>
				</uni-col>
				<uni-col :span="16">
						<uni-easyinput type="text"v-model="tableSupplier.currency" clearSize="0"></uni-easyinput>
				</uni-col>
			</uni-row>
			
			<!-- <uni-row style="margin-top: 10rpx;">
				<uni-col :span="7">
						<view style="line-height:70rpx;font-size:30rpx;">经营范围:</view>
				</uni-col>
				<uni-col :span="16">
						<uni-easyinput type="text"v-model="tableSupplier.businessScope" clearSize="0"></uni-easyinput>
				</uni-col>
			</uni-row> -->
			
			
			<uni-row style="margin-top: 10rpx;">
				<uni-col :span="7">
						<view style="line-height:70rpx;font-size:30rpx;">经营性质:</view>
				</uni-col>
				<uni-col :span="16">
						<uni-easyinput type="text"v-model="tableSupplier.businessNature" clearSize="0"></uni-easyinput>
				</uni-col>
			</uni-row>
			
			
			<uni-row style="margin-top: 10rpx;">
				<uni-col :span="7">
						<view style="line-height:70rpx;font-size:30rpx;">公司官网:</view>
				</uni-col>
				<uni-col :span="16">
						<uni-easyinput type="text"v-model="tableSupplier.officialWebsite" clearSize="0"></uni-easyinput>
				</uni-col>
			</uni-row>
			
			</uni-card>
			<!-- </uni-collapse-item>
			</uni-collapse> -->
				
		
		</view>
		
	</view>
	
	<view v-if="current === 2">
		<view>
			<uni-card>
		<uni-row style="margin-top: 10rpx;">
			<uni-col :span="7">
					<view style="line-height:70rpx;font-size:30rpx;">付款条件:</view>
			</uni-col>
			<uni-col :span="16">
					<uni-easyinput type="text"v-model="tableSupplier.pynmtGroup" clearSize="0"></uni-easyinput>
			</uni-col>
		</uni-row>
		<uni-row style="margin-top: 10rpx;">
			<uni-col :span="7">
					<view style="line-height:70rpx;font-size:30rpx;">应付账款:</view>
			</uni-col>
			<uni-col :span="16">
		
					<uni-easyinput type="text" v-model="tableSupplier.acctCode" clearSize="0"></uni-easyinput>
			</uni-col>
		</uni-row>
		<!-- <uni-row style="margin-top: 10rpx;">
			<uni-col :span="7">
					<view style="line-height:70rpx;font-size:30rpx;">价格清单:</view>
			</uni-col>
			<uni-col :span="16">
					<uni-easyinput type="text"  v-model="tableSupplier.listNum" clearSize="0"></uni-easyinput>
			</uni-col>
		</uni-row> -->
		<!-- <uni-row style="margin-top: 10rpx;">
			<uni-col :span="7">
					<view style="line-height:70rpx;font-size:30rpx;">信用额度:</view>
			</uni-col>
			<uni-col :span="16">
					<uni-easyinput type="text"  v-model="tableSupplier.creditLine" clearSize="0"></uni-easyinput>
			</uni-col>
		</uni-row> -->
		<!-- <uni-row style="margin-top: 10rpx;">
			<uni-col :span="7">
					<view style="line-height:70rpx;font-size:30rpx;">欠款利息%:</view>
			</uni-col>
			<uni-col :span="16">
					<uni-easyinput type="text"v-model="tableSupplier.intrstRate" clearSize="0"></uni-easyinput>
			</uni-col>
		</uni-row> -->
		<!-- <uni-row style="margin-top: 10rpx;">
			<uni-col :span="7">
					<view style="line-height:70rpx;font-size:30rpx;">总计折扣%:</view>
			</uni-col>
			<uni-col :span="16">
					<uni-easyinput type="text"  v-model="tableSupplier.totalCount" clearSize="0"></uni-easyinput>
			</uni-col>
		</uni-row> -->
		<!-- <uni-row style="margin-top: 10rpx;">
			<uni-col :span="7">
					<view style="line-height:70rpx;font-size:30rpx;">承付款额度:</view>
			</uni-col>
			<uni-col :span="16">
					<uni-easyinput type="text" v-model="tableSupplier.debtLine" clearSize="0"></uni-easyinput>
			</uni-col>
		</uni-row> -->
		</uni-card>
		</view>
	</view>
	
	
	
	
	<view v-if="current === 3">
		<view>
		<uni-card>		<uni-row style="margin-top: 10rpx;">
			<uni-col :span="7">
					<view style="line-height:70rpx;font-size:30rpx;">联系人:</view>
			</uni-col>
			<uni-col :span="16">
					<uni-easyinput type="text"v-model="tableSupplier.contactPerson" clearSize="0"></uni-easyinput>
			</uni-col>
		</uni-row>
		<uni-row style="margin-top: 10rpx;">
			<uni-col :span="7">
					<view style="line-height:70rpx;font-size:30rpx;">职务:</view>
			</uni-col>
			<uni-col :span="16">
					<uni-easyinput type="text"v-model="tableSupplier.title" clearSize="0"></uni-easyinput>
			</uni-col>
		</uni-row>
		<uni-row style="margin-top: 10rpx;">
			<uni-col :span="7">
					<view style="line-height:70rpx;font-size:30rpx;">电话:</view>
			</uni-col>
			<uni-col :span="16">
					<uni-easyinput type="text"v-model="tableSupplier.contactPhone" clearSize="0"></uni-easyinput>
			</uni-col>
		</uni-row>
		<uni-row style="margin-top: 10rpx;">
			<uni-col :span="7">
					<view style="line-height:70rpx;font-size:30rpx;">传真:</view>
			</uni-col>
			<uni-col :span="16">
					<uni-easyinput type="text"v-model="tableSupplier.fax" clearSize="0"></uni-easyinput>
			</uni-col>
		</uni-row>
		<uni-row style="margin-top: 10rpx;">
			<uni-col :span="7">
					<view style="line-height:70rpx;font-size:30rpx;">手机:</view>
			</uni-col>
			<uni-col :span="16">
					<uni-easyinput type="text"v-model="tableSupplier.cellPhone" clearSize="0"></uni-easyinput>
			</uni-col>
		</uni-row>
		<uni-row style="margin-top: 10rpx;">
			<uni-col :span="7">
					<view style="line-height:70rpx;font-size:30rpx;">电子邮箱:</view>
			</uni-col>
			<uni-col :span="16">
					<uni-easyinput type="text"v-model="tableSupplier.email" clearSize="0"></uni-easyinput>
			</uni-col>
		</uni-row>
			
		<uni-row style="margin-top: 10rpx;">
			<uni-col :span="3">
					<view style="line-height:70rpx;font-size:30rpx;">备注:</view>
			</uni-col>
			<uni-col :span="20">
					<uni-easyinput type="textarea" v-model="tableSupplier.notes" clearSize="0"></uni-easyinput>
			</uni-col>
		</uni-row>
		</uni-card>
		
		</view>
	</view>
	
	
  	<view v-if="current === 5">
		<view>
	<!-- 照片显示 -->	
	<uni-row style="margin-top: 10rpx;margin-left: 10px;">
			<view> 
			    <view>营业执照图:</view>
				<view v-for="(item,index) in img1" :key=index style="display: inline-block;margin-left:2%">
					<image :src="imgurl+'/base/document/file?filePath='+item.saveUrl" style="width: 210rpx;height:200rpx;"@click="look(img1[index].saveUrl)" />
				</view>
				
			</view>
	</uni-row>
	<uni-row style="margin-top: 10rpx;margin-left: 10px;">
			<view> 
			    <view>供应商资质图:</view>
				<view v-for="(item,index) in img2" :key=index style="display: inline-block;margin-left:2%">
					<image :src="imgurl+'/base/document/file?filePath='+item.saveUrl" style="width: 210rpx;height:200rpx;" @click="look(img2[index].saveUrl)" />
				</view>
			</view>
	</uni-row>
	<uni-row style="margin-top: 10rpx;margin-left: 10px;">
			<view> 
			    <view>供应商相册:</view>
				<view v-for="(item,index) in img3" :key=index style="display: inline-block;margin-left:2%">
					<image :src="imgurl+'/base/document/file?filePath='+item.saveUrl" style="width: 210rpx;height:200rpx;"@click="look(img3[index].saveUrl)" />
				</view>
			</view>
	</uni-row>
	

	<uni-row style="margin-top: 10rpx;text-align: center;">
		<uni-col :span="8"><button type="primary" size="mini" @click="edit()">通过</button></uni-col>
		<uni-col :span="8"><button type="warn" size="mini" @click="Noedit()">驳回</button></uni-col>
		<uni-col :span="8"><button type="default" size="mini" @click="clear()">返回</button></uni-col>
	</uni-row>
	
	</view>
  
  
  
	</view>
<view v-if="current === 4">
  		   <uni-card>
  		 <uni-table border stripe >
  		 	<uni-tr style="white-space: nowrap;text-align: center;font-size: 12rpx;">
  		 		<uni-th align="center">设备型号</uni-th>
  		 		<uni-th align="center">设备名称</uni-th>
  		 		<uni-th align="center">数量</uni-th>
  		 		<uni-th align="center">备注</uni-th>
  		 	</uni-tr>
  		 	<uni-tr v-for="(item,index) in tables" :key="index" style="white-space: nowrap;text-align: center;font-size: 12rpx">
  		 		<uni-td align="center">{{item.deviceModel}}</uni-td>
  		 		<uni-td align="center">{{item.deviceName}}</uni-td>
  		 		<uni-td align="center">{{item.deviceAmount}}</uni-td>
  		 		<uni-td align="center">{{item.notes}}</uni-td>
  		 		
  		 	</uni-tr>
  		 </uni-table>
  		 </uni-card>
   </view>	  
  
  </view>
 

  </view>
</template>

<script>
	import {examineSupplierRowId,DocumentFormDatatable,supplierFormViewRowId} from '@/api/system/user'
	import config from '@/config'
	export default {
		data() {
			return {
			current:0,
			imgurl:config.baseUrl,
			tables:[],
			img1:[],
			img2:[],
			img3:[],
			SupplierForm:{
			grade:null,
			score:null,
			examineStatus:null,
			},
			tableSupplier:[],
			items: ['常规','合法信息', '付款条件','联系人','设备','附件'],
			}
			
		},
		onLoad() {
			const eventChannel = this.getOpenerEventChannel();
			eventChannel.on('acceptDataFromOpenerPage', (data) => {
			  this.tableSupplier = data.data
			})
			
		supplierFormViewRowId(this.tableSupplier.rowId).then(res=>{
			 this.tables=res.data.supplierDeviceFormList
		})
			    this.code=this.tableSupplier.supplierCode //供应商编号
				this.getImagebusinessLicense() 
				this.getImagequalificationFile()
				this.getImagephoto()
				
			    
			
		},
		methods: {
			
			look(current) {
			 var arr = [];
			  arr.push(this.imgurl+'/base/document/file?filePath='+current);
			 					uni.previewImage({
			 					urls:arr,	
			 					})
			 				},
			getImagebusinessLicense(){
				this.docLabel='businessLicense'
				DocumentFormDatatable(this.code,this.docLabel).then(res=>{
					this.img1=res.rows
				})
			},
			getImagequalificationFile(){
				this.docLabel='qualification'
				DocumentFormDatatable(this.code,this.docLabel).then(res=>{
				this.img2=res.rows
				
				})
			},
			getImagephoto(){
				this.docLabel='photo'
				DocumentFormDatatable(this.code,this.docLabel).then(res=>{
					this.img3=res.rows
				})
			},
			
			
			
		edit(){
			let rowId = this.tableSupplier.rowId
			this.SupplierForm.examineStatus=1
			examineSupplierRowId(rowId,this.SupplierForm).then(res=>{
				this.$tab.reLaunch('/pages/work/purchaser/purchaser_list_register')
			})
		},
		Noedit(){
			let rowId = this.tableSupplier.rowId
			this.SupplierForm.examineStatus=2	
			examineSupplierRowId(rowId,this.SupplierForm).then(res=>{
				this.$tab.reLaunch('/pages/work/purchaser/purchaser_list_register')
			})	
			},
			//返回上一层
		clear(){
				this.$tab.reLaunch('/pages/work/purchaser/purchaser_list_register')
			},
	    back(){
		this.$tab.reLaunch('/pages/work/purchaser/purchaser_list_register')
			  },
		onClickItem(e) {
			if (this.current !== e.currentIndex) {
			this.current = e.currentIndex
				}
					},
		}
	}
</script>

<style>

</style>
